//
//  SearchFailView.m
//  JunZeWristband
//
//  Created by Kendama on 2017/9/1.
//  Copyright © 2017年 DT. All rights reserved.
//

#import "SearchFailView.h"

@implementation SearchFailView

#pragma mark - 懒加载
- (UIImageView *)iconImageView
{
    if(!_iconImageView)
    {
        UIView *superView = self;
        _iconImageView = [[UIImageView alloc]init];
        [superView addSubview:_iconImageView];
        _iconImageView.image = [UIImage imageNamed:@"icon_search"];
    }
    return _iconImageView;
}
- (UILabel *)tipLabel
{
    if(!_tipLabel)
    {
        UIView *superView = self;
        _tipLabel = [[UILabel alloc]init];
        [superView addSubview:_tipLabel];
        [_tipLabel setFont:[UIFont systemFontOfSize:15]];
        [_tipLabel setTextColor:[UIColor grayColor]];
        _tipLabel.numberOfLines = 0;
        _tipLabel.text = @"未能搜索到手环，请确保手环在手机附近~";
    }
    return _tipLabel;
}
- (UIButton *)searchButton
{
    if(!_searchButton)
    {
        UIView *superView = self;
        _searchButton = [[UIButton alloc]init];
        [superView addSubview:_searchButton];
        [_searchButton setTitle:@"重新搜索" forState:UIControlStateNormal];
        [_searchButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_searchButton.titleLabel setFont:[UIFont systemFontOfSize:15]];
        [_searchButton setBackgroundImage:[UIImage imageNamed:@"but_login"] forState:UIControlStateNormal];
    }
    return _searchButton;
}


- (void)masLayoutSubview
{
    __weak UIView *superView = self;
    [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(superView.mas_top).with.offset(px1920Height(250));
        make.centerX.mas_equalTo(superView.mas_centerX);
    }];
    
    [self.tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.iconImageView.mas_bottom).with.offset(px1920Height(210));
        make.centerX.mas_equalTo(superView.mas_centerX);
    }];
    
    [self.searchButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.tipLabel.mas_bottom).with.offset(px1920Height(130));
        make.centerX.mas_equalTo(superView.mas_centerX);
    }];
}

@end
